import config from '../../utils/config';
import apiCreator from '../../utils/apiCreator';

export default function attributeAnalysisAPI(api) {
  return {
    // 获取收益分解Brinson
    getIncome: {
      Brinson: (query) => api.get(`${config.interfaces.type3}attribute/brinsonProfitDecomposition/`, query),
      Campisi: (query) => api.get(`${config.interfaces.type3}attribute/campisiProfitDecomposition/`, query),
      Barra: (query) => api.get(`${config.interfaces.type3}barra/returnDecomposition/`, query),
    },
    // 获取超额收益趋势
    getExcessTrend: {
      Brinson: (query) => api.get(`${config.interfaces.type3}attribute/brinsonExcessProfitTrend/`, query),
      Campisi: (query) => api.get(`${config.interfaces.type3}attribute/campisiExcessProfitTrend/`, query),
      Barra: (query) => api.get(`${config.interfaces.type3}barra/excessReturnSeries/`, query),
    },
    // 行业权重差&&行业收益贡献差
    getDiffWeight: (query) => api.get(`${config.interfaces.type3}attribute/brinsonClassDecomposition/`, query),
    // 归因明细
    getAttributeInfo: {
      Brinson: (query) => api.get(`${config.interfaces.type3}attribute/brinsonAttributionDetails/`, query),
      Campisi: (query) => api.get(`${config.interfaces.type3}attribute/campisiAttributionDetails/`, query),
    },
    // 按修正久期&&债券类别
    getRevisionPeriod: (query) => api.get(`${config.interfaces.type3}attribute/campisiDimensionCount/`, query),
    // 因子收益率
    getFactorYield: (query) => api.get(`${config.interfaces.type3}barra/factorReturn/`, query),
    // 因子暴露度
    getFactorExposure: (query) => api.get(`${config.interfaces.type3}barra/factorExposure/`, query),
    // 查询日期区间下是否有数据
    getBenchData: (query) => api.get(`${config.interfaces.type3}attribute/benchData/`, query),
    // 因子收益贡献
    getFactorContributionDetail: (query) => api.get(`${config.interfaces.type3}barra/factorContributionDetail/`, query),
  };
}
